package com.wsx.generate;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;

import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

public class Generater {
	public static void getone() throws BiffException, IOException{
		PrintStream ps=new PrintStream(new FileOutputStream("doc/grade/one")); 
        System.setOut(ps);
		Workbook workbook = Workbook.getWorkbook(new File("doc/iotgrade.xls"));
		Sheet sheet = workbook.getSheet(0);
		for (int i = 1; i < sheet.getRows(); i++) {
			for (int j = 1; j < sheet.getColumns(); j++) {
				Cell cell = sheet.getCell(j,i);
				System.out.print(cell.getContents().trim() + " ");
			}
			System.out.println();
		}
		workbook.close();
	}
	
	public static void gettwo() throws BiffException, IOException{
		PrintStream ps=new PrintStream(new FileOutputStream("doc/grade/two"));  
        System.setOut(ps);
		Workbook workbook = Workbook.getWorkbook(new File("doc/iotgrade.xls"));
		Sheet sheet = workbook.getSheet(1);
		for (int i = 1; i < sheet.getRows(); i++) {
			for (int j = 1; j < sheet.getColumns(); j++) {
				Cell cell = sheet.getCell(j,i);
				System.out.print(cell.getContents().trim() + " ");
			}
			System.out.println();
		}
		workbook.close();
	}
	
	public static void main(String[] args) throws BiffException, IOException {
		getone();
		gettwo();
	}

}
